\documentclass[11pt]{article}
%% \topmargin -1.5cm        % read Lamport p.163
%% \oddsidemargin -0.04cm   % read Lamport p.163
%% \evensidemargin -0.04cm  % same as oddsidemargin but for left-hand pages
%% \textwidth 16.59cm
%% \textheight 21.94cm 
%$ %\pagestyle{empty}       % Uncomment if don't want page numbers
\parskip 7.2pt           % sets spacing between paragraphs
%% %\renewcommand{\baselinestretch}{1.5} % Uncomment for 1.5 spacing between lines
\parindent 0pt		 % sets leading space for paragraphs

\usepackage{fullpage}
\usepackage{listings} % For source code
\usepackage[usenames,dvipsnames]{color} % For colors and names
\usepackage[pdftex]{graphicx}
\usepackage{subfigure}
\usepackage{fixltx2e}
\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}}

\usepackage{amssymb,amsmath}

\definecolor{mygrey}{gray}{.96} % Light Grey
\lstset{ 
        language=[ISO]C++,              
        tabsize=3,                                                     
        basicstyle=\tiny,               
        numbers=left,                   
        numberstyle=\tiny,              
        stepnumber=2,                   
        numbersep=5pt,                  
        backgroundcolor=\color{white}, 
        %showspaces=false,              
        %showstringspaces=false,        
        %showtabs=false,                
        frame=single,                    
        tabsize=3,                          
        captionpos=b,                   
        breaklines=true,                
        breakatwhitespace=false,        
        %escapeinside={\%*}{*)},        
        commentstyle=\color{BrickRed}   
}

\title{ECE5666 \\
  Final Exam \\
  Paul Ozog
  \date{\today}
  \author{
    Instructor: Deniz Erdogmus \\
  }
}

\begin{document}

\section*{Paul Ozog - Question 1}
\subsection*{Part (a)}

Let 
\begin{displaymath}
  \hat{y}[n] = \left\{
  \begin{array}{lr}
    y[n]: & 0 \leq n \leq Q - 1\\
    0: & else
  \end{array}
  \right.
\end{displaymath}
for some Q such that 
\begin{math}
  \hat{y}[n]
\end{math}
is representative of 
\begin{math}
  y[n].
\end{math}

We can estimate
\begin{math}
  \phi_{yy}[m]
\end{math}
using
\begin{math}
  \hat{y}[n] 
\end{math}
with equation 10.83 in Oppenheim-Shafer Ed 2:

\begin{displaymath}
  \phi_{yy}[m] = \left\{
  \begin{array}{lr}
    \displaystyle\frac{1}{Q} \sum\limits_{n=0}^{Q - |m| - 1} \hat{y}[n] \hat{y}[n+m]: & |m| \leq Q - 1 \\
    \\
    0: & else
  \end{array}
  \right.
\end{displaymath}

\subsection*{Part (b)}
\begin{eqnarray}
  \phi_{yy}[m] & = & h[m] * h^*[-m] * \phi_{xx}[m] \nonumber \\
  & = & h[m] * h^*[-m] * \delta[m]  \nonumber \\
  & = & h[m] * h^*[-m] \nonumber
\end{eqnarray}

In the Z-domain:

\begin{displaymath}
  Z(h[m] * h^*[-m]) = H(z) H^*\left(1/z^*\right) = \Phi_{yy}(z)
\end{displaymath}

\begin{displaymath}
  H(z) = G \left( \frac{\prod\limits_{k=1}^M(1-c_kz^{-1})}{\prod\limits_{k=1}^M(1-d_kz^{-1})} \right)
\end{displaymath}
\begin{displaymath}
  H^*\left(1/z^*\right) = G \left(\frac{\prod\limits_{k=1}^M(1-c_k^*z)}{\prod\limits_{k=1}^M(1-d_k^8z)}\right)
\end{displaymath}

{\bf Procedure}:
Define C(z) as follows:
\begin{displaymath}
  C(z) = \Phi_{yy}(z) = G^2 \left(\frac{\prod\limits_{k=1}^M(1-c_kz^{-1})(1-c_k^*z)}{\prod\limits_{k=1}^M(1-d_kz^{-1})(1-d_k^*z)}\right)
\end{displaymath}

So for each pole pair
\begin{math}
  \{d_k, \frac{1}{d_k^*}\}
\end{math}
of 
\begin{math}
  \Phi_{yy}(z),
\end{math}
if one pole is inside the unit circle, then it's a pole of H(z).

Similarly, for each zero pair
\begin{math}
  \{c_k, \frac{1}{c_k^*}\}
\end{math}
of
\begin{math}
  \Phi_{yy}(z),
\end{math}
if one zero is inside the unit circle, then it's a zero of H(z).  Note that the zero identification of H(z) from C(z) is {\it only} possible if h[n] is known to be minimum phase.

Finally, the value G
can be determined by taking the positive root of {G}\textsuperscript{2}.

Knowing the poles, zeros, and scale factor G, one can uniquely identify 
\begin{math}
  H(z).
\end{math}
Similarly, one can uniquely identify the causal and stable inverse
\begin{math}
  H^{-1}(z)
\end{math}
by swapping the poles and zeros of H(z), and inverting G.  The ROC's of 
\begin{math}
  H(z) \mbox{ and } H^{-1}(z)
\end{math}
are the right-sided region that contains the unit circle.  

\section*{Paul Ozog - Question 2}
Since the length of x[n] is 2N, there are an even number of elements in the sequence.  
It's also clear that {x}\textsubscript{0}[n] are the even-indexed
 elements of x[n]
 and {x}\textsubscript{1}[n] are the odd-indexed elements of x[n]. 
The length-2N DFT of such a sequence may be expressed as follows:
\begin{eqnarray}
  X[k] & = & \sum\limits_{n=0}^{2N - 1}x[n]W_{2N}^{nk}
  \nonumber \\
  & = & \sum\limits_{n=0}^{N -1} x[2n] W_{2N}^{2nk} + \sum\limits_{n=0}^{N -1} x[2n+1] W_{2N}^{(2n+1)k}
  \nonumber \\
  & = & X_0[k] + X_1[k]W_{2N}^k[k]
  \nonumber
\end{eqnarray}

Note that {X}\textsubscript{0}[k] and {X}\textsubscript{1}[k] are periodic in N, and X[k] is periodic in 2N.

For the rest of this problem, I refer to Figure \ref{foobar} on the next page.

\begin{figure}[h]
  \begin{center}
    \includegraphics[scale=1]{q2001.jpg}
    \caption{2N-point DFT of x[n]}
    \label{foobar}
  \end{center}
\end{figure}

By looking at the figure, we have two equations:
\begin{equation}
  X_0[k] = X[k] - W_{2N}^kX_1[k]
\end{equation}
\begin{equation}
  X_1[k] = \frac{X[k+N] - X_0[k]}{W_{2N}^{k+N}} = W_{2N}^{-k-N}\left(X[k+n] - X_0[k]\right)
\end{equation}

So we solve for {X}\textsubscript{0}[k]:
\begin{displaymath}
  X_0[k] = X[k] - W_{2N}^{-N}\left(X[k+N] - X_0[k]\right)
\end{displaymath}

Note that
\begin{displaymath}
  W_{2N}^{-N} = e^{\frac{j2\pi N}{2N}} = -1
\end{displaymath}

This gives us
\begin{displaymath}
  2X_0[k] = X[k] + X[k+N]
\end{displaymath}

So finally
\begin{displaymath}
  X_0[k] = \boxed{\frac{X[k] + X[k+N]}{2}}
\end{displaymath}

\section*{Paul Ozog - Question 3}
\subsection*{Part (a)}
\begin{eqnarray}
  & & \sum\limits_{m=-\infty}^{\infty} \left( a_1 x_1[n+m] + a_2 x_2[n+m] \right) w[m] e^{-j\lambda m}
  \nonumber \\
  & = & a_1\sum\limits_{m=-\infty}^{\infty} x_1[n+m]w[m]e^{-j\lambda m} + a_2\sum\limits_{m=-\infty}^{\infty}
  x_2[n+m]w[m]e^{-j\lambda m} = \boxed{a_1 X_1[n, \lambda) + a_2 X_2[n, \lambda)}
  \nonumber 
\end{eqnarray}

\subsection*{Part (b)}
\begin{displaymath}
  \sum\limits_{m=-\infty}^{\infty} x[n-n_0+m] w[m] e^{-j\lambda m}
\end{displaymath}

Let 
\begin{math}
  k = n-n_0
\end{math}

\begin{displaymath}
  \sum\limits_{m=-\infty}^{\infty} x[k+m] w[m] e^{-j\lambda m} = X[k, \lambda)|_{_{k=n-n_0}}
    = \boxed{X[n-n_0, \lambda)}
\end{displaymath}

\subsection*{Part (c)}
\begin{eqnarray}
  & & \sum\limits_{m=-\infty}^{\infty} e^{j\omega_0 (n+m)} x[n+m] w[m] e^{-j\lambda m}
  \nonumber \\
  & = & e^{j\omega_0 n} \sum\limits_{m=-\infty}^{\infty} x[n+m] w[m] e^{-jm(\lambda - \omega_0)} = \boxed{e^{j\omega_0n}X[n, \lambda - \omega_0)} 
  \nonumber
\end{eqnarray}

\subsection*{Part (d)}
Consider
\begin{math}
  X^*[n, -\lambda):
\end{math}

\begin{displaymath}
  = \sum\limits_{m=-\infty}^{\infty} x^*[n+m] w^*[m] \left(e^{j\lambda m} \right)^*
\end{displaymath}

Note that 
\begin{math}
  x^*[n+m] = x[n+m]
\end{math}
(this is given) and
\begin{math}
  w^*[m] = w[m].
\end{math}
Window seqeunces are generally purely real (rectangular, triangular, Hanning, Hamming, etc).

\begin{displaymath}
  = \sum\limits_{m=-\infty}^{\infty} x[n+m] w[m] e^{-j\lambda m} = \boxed{X[n, \lambda)}
\end{displaymath}

\section*{Paul Ozog - Question 4}
\subsection*{Part (a)}
The ideal Hilbert transformer has DTFT
\begin{displaymath}
  H(e^{j\omega}) = \left\{
  \begin{array}{lr}
    -j: & 0 < w < \pi\\
    +j : & -\pi < w < 0
  \end{array}
  \right.
\end{displaymath}

Clearly
\begin{displaymath}
  \left| H(e^{j\omega}) \right|^2 = 1, \;\;\; \forall \omega
\end{displaymath}

Since 
\begin{math}
  x_r[n]
\end{math}
is WSS and h[n] is a LTI system:
\begin{displaymath}
  \phi_{x_ix_i}[m] = h[m] * \phi_{x_rx_r}[m] * h^*[-m] = \phi_{x_rx_r}[m] * c_{hh}[m] 
\end{displaymath}

\begin{displaymath}
  c_{hh}[m] = \mathfrak{F}^{-1} \left(\left| H(e^{j\omega}) \right|^2 \right) = \delta[m]
\end{displaymath}

\begin{displaymath}
  \phi_{x_ix_i}[m] = \phi_{x_rx_r}[m] * c_{hh}[m] = \phi_{x_rx_r}[m] * \delta[m] = \boxed{\phi_{x_rx_r}[m]}
\end{displaymath}

\subsection*{Part (b)}
\begin{displaymath}
  \boxed{\phi_{x_rx_i}[m] = h[m] * \phi_{x_rx_r}[m]} = \sum\limits_{k=-\infty}^{\infty}h[k]\phi_{x_rx_r}[m]
\end{displaymath}

{\bf Note the following:}

\begin{enumerate}
  \item If 
    \begin{math}
      \phi_{x_rx_i}[m]
    \end{math}
    is odd in m
    \begin{math}
      \Leftrightarrow \phi_{x_rx_i}[m] = -\phi_{x_rx_i}[-m].
    \end{math}  

  \item 
    \begin{math}
      -h^*[-m] = \frac{2sin(-\frac{\pi m}{2}) sin(\frac{-\pi m}{2})}{m} = \frac{2sin^2(\frac{\pi m}{2})}{m} = h[m]
    \end{math}

  \item 
    \begin{math}
      a(f*g) = (af) * g = f * (ag)
    \end{math}

  \item The autocorrelation of a DT WSS sequence x[n] is even:
    \begin{math}
      \phi_{xx}[l] = \phi_{xx}[-l]
    \end{math}

  \item
    \begin{math}
      \phi_{x_ix_r}[m] = \phi_{x_rx_r}[m] * h^*[-m] = -(\phi_{x_rx_r}[m] * h[m]) = -\phi_{x_rx_i}[m]
    \end{math}

\end{enumerate}


And now to show the cross correlation is odd in m...
\begin{eqnarray}
  -\phi_{x_rx_i}[-m] & = & - \left( h[-m] * \phi_{x_rx_r}[-m] \right) = - h[-m] * \phi_{x_rx_r}[-m]  
  \nonumber \\
  & = & h[m] * \phi_{x_rx_r}[m]
  \nonumber \\
  & = & \boxed{\phi_{x_rx_i}[m]}
  \nonumber
\end{eqnarray}
\subsection*{Part (c)}
Given that 
\begin{math}
  x[n] = x_r[n] + j x_i[n]:
\end{math}

\begin{eqnarray}
  \phi_{xx}[m] & = & E[x[n] x^*[n+m]] \nonumber \\
  & = & E[(x_r[n] + j x_i[n])(x_r[n+m] - j x_i[n+m])] \nonumber \\
  & = & E[x_r[n]x_r[n+m]] + E[x_i[n]x_i[n+m]] - j E[x_r[n]x_i[n+m]] + j E[x_i[n]x_r[n+m]] \nonumber \\
  & = & \phi_{x_rx_r}[m] + \phi_{x_ix_i}[m] - j\phi_{x_rx_i}[m] + j\phi_{x_ix_r}[m] \nonumber \\
  & = & 2\phi_{x_ix_i}[m] - j\phi_{x_rx_i}[m] - j\phi_{x_rx_i}[m] \nonumber \\
  & = & \boxed{2\phi_{x_ix_i}[m] - 2j\phi_{x_rx_i}[m]} \nonumber
\end{eqnarray}

\subsection*{Part (d)}
\begin{eqnarray}
  P_{xx}(\omega) & = & \mathfrak{F}\left( \phi_{xx}[m] \right) \nonumber \\
  & = & 2 \Phi_{x_ix_i}(e^{j\omega}) - j 2 \Phi_{x_rx_i}(e^{j\omega})  \nonumber 
\end{eqnarray}

By taking the DTFT of (b), we can simplify this to be in terms of the system's DTFT and input sequence's DTFT:
\begin{eqnarray}
  P_{xx}(\omega) & = & 2 \Phi_{x_rx_r}(e^{j\omega}) - j 2 H(e^{j\omega})\Phi_{x_rx_r}(e^{j\omega})
  \nonumber \\
  & = & \boxed{2 \left( 1 - j H(e^{j\omega}) \right) \Phi_{x_rx_r}(e^{j\omega})}
  \nonumber
\end{eqnarray}

\end{document}
